$i = 0; //將便當袋中的便當印出來 foreach($_SESSION['bag']->lunchbox_number as $lunchbox_number) { if($i % 2 == 0) echo '